<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <%@include file="/WEB-INF/common/hplus-css.jsp"%>
</head>
<body class="gray-bg">
     <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox">
                    <div class="ibox-content">
                        <form action="${path}/setting/edit" class="form-horizontal m-t" id="settingForm" method="post">
                          <input id="id" name="id" type="hidden" value="${setting.id}">
                            	<div class="form-group" style="padding: 0px;">
									<label class="col-sm-2 control-label">名称：</label>
									<div class="col-sm-8">
										<input type="text" id="name" name="name" minlength="2"
											class="form-control" required="" aria-required="true" value="${setting.name}">
									</div>

								</div>
								<div class="form-group"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">编码：</label>
									<div class="col-sm-8">
										<input type="text" id="code" name="code" minlength="2"
											class="form-control" required="" aria-required="true" value="${setting.code}">
									</div>
								</div>
								<div class="form-group"></div>
								<div class="form-group">
									<label class="col-sm-2 control-label">父级菜单：</label>
									<div class="col-sm-8">
										<input type="text" id="pid" name="pid"
											class="form-control" required="" readonly aria-required="true" value="${setting.pid }">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">字典值：</label>
									<div class="col-sm-8">
										<input type="text" class="form-control" id="val" name="val"
											value="${setting.val}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">扣分项：</label>
									<div class="col-sm-8">
										<input type="text" class="form-control" id="integral" name="integral" value="${setting.points}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">手机版名称：</label>
									<div class="col-sm-8">
										<input type="text" class="form-control" id="sims" name="sims" value="${setting.sims}">
									</div>
								</div>
								<div class="form-group">
									<div class="col-sm-8 col-sm-offset-3">
										<button class="btn btn-primary" id="add-btn" type="button">提交</button>
										<button class="btn btn-danger" style="margin-left:30px;" id="return-btn" type="button">关闭</button>
									</div>
								</div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <%@include file="/WEB-INF/common/hplus-js.jsp"%>
    <script src="${path}/assets/hplus/js/demo/form-validate-demo.js"></script>
    <script>
        $(document).ready(function () {
        	$("#settingForm").validate();
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
            $("#return-btn").on("click",function(){
            	parent.layer.closeAll();
     		});
            $("#add-btn").click(function(){
            	var valid = $("#settingForm").valid();
            	if(valid){
            		$("#settingForm").ajaxSubmit({
                        dataType: "json",
                        success: function (json) {
                            var code = json.code;
                            if(code == 0){
                            	layer.msg('修改成功', {icon: 1});
                                setTimeout(function(){
                                	location.href='${path}/setting/query';
                                	parent.layer.closeAll();
                                }, 1000);
                            }else{
                            	layer.msg('修改发生错误:' + json.msg, {icon: 5});
                            }
                        },
                        error:function(){
                        	layer.msg('修改发生错误', {icon: 5});
                        }
                    });
            	}else{
            		layer.msg("请填写完整信息！！！！", {
						icon : 5
					});
            	}
            });
        });
       /*  function relaod(){
        	$.ajax({
                type: "GET",
                url:"${path}/setting/query",
               // dataType:"json",
                async: false,
                success:function(result) {
                	
                }
            }) 
        }*/
    </script>
</body>
</html>
